<template>
	<div class="diBusiness-container">
		<el-dialog v-model="state.isShowDialog" draggable width="769px">
			<template #header>
				<div style="color: #fff">
					<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit />
					</el-icon>
					<span> 修改密码 </span>
				</div>
			</template>
			<el-form :model="state.ruleForm" ref="ruleFormRef" size="default" label-width="80px" :rules="rules">
				<el-row :gutter="35">
					<el-col :xs="12" :sm="12" :md="24" :lg="12" :xl="12" class="mb20">
						<el-form-item label="当前密码">
							<el-input v-model="state.ruleForm.PasswordOld" class="w100" clearable show-password />
						</el-form-item>
					</el-col>
					<el-col :xs="12" :sm="12" :md="24" :lg="12" :xl="12" class="mb20">
						<el-form-item label="新密码">
							<el-input v-model="state.ruleForm.PasswordNew" class="w100" clearable show-password />
						</el-form-item>
					</el-col>
				</el-row>
			</el-form>
			<template #footer>
				<span class="dialog-footer">
					<el-button @click="submit" size="default">确 定</el-button>
				</span>
			</template>
		</el-dialog>
	</div>
</template>

<script lang="ts" setup name="editpersonaloucher">
import { reactive, ref } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import type { FormRules } from "element-plus";
import mittBus from '/@/utils/mitt';
import SyspersonalApi from '/@/api/personal/index';

// 定义变量内容
const props = defineProps({
	title: String,
});
const ruleFormRef = ref();
const state = reactive({
	isShowDialog: false,
	ruleForm: {},
});

// 删除非必填规则
const rules = ref<FormRules>({

});

// 打开弹窗.
const openDialog = () => {
	// state.ruleForm = JSON.parse(JSON.stringify(row));
	state.isShowDialog = true;
};

// 关闭弹窗
const closeDialog = () => {
	mittBus.emit('submitRefresh');
	state.isShowDialog = false;
};

// 取消
const cancel = () => {
	state.isShowDialog = false;
};

// 提交
const submit = () => {
	ruleFormRef.value.validate(async (valid: boolean, fields?: any) => {
		let res = await SyspersonalApi().editPost(state.ruleForm);
		ElMessage.success("操作成功");
		closeDialog();
	});
};

// 导出对象 将属性或者函数暴露给父组件
defineExpose({ openDialog });
</script>

<style lang="scss" scoped>
.higlabel {
    :deep( label) {
		display: flex;
		align-items: center;
	}
}

.formItemLog {
	background-color: #222222;
	width: 100%;

	span {
		font-size: 10px;
		color: #767575;
	}

	.phone {
		font-size: 14px;
		color: #fff;
		line-height: 10px;
	}

	.logItem {
		font-size: 12px;
		line-height: 22px;
	}
}
</style>
